package {
	import flash.text.TextFormat;
	import flash.text.TextField;
	import flash.display.Sprite;


	public class Toolbar extends Sprite {
		private var myScore:TextField;
		private var myFloats: uint = 0;
		
		private var myMoney:TextField;
		private var myCoins:uint = 0;
		
		private var myLife : TextField;
		private var myLives : uint =0;
		
		private var myFormat:TextFormat = new TextFormat();
		
		
		public function Toolbar() {
			drawToolbar();
			setFormat();
			putScore();
			putLife();
			putCoins();
			putOptionPause();
			putOptionSound();
		}
		private function putOptionSound():void{
			var sound:TextField = new TextField();
			sound.defaultTextFormat = myFormat;
			sound.x = 400;
			sound.y = 30;
			sound.width = 150;
			sound.text = 'S : Sound off/on';
			addChild(sound);
		}
		private function putOptionPause():void{
			var pause:TextField = new TextField();
			pause.defaultTextFormat = myFormat;
			pause.x = 400;
			pause.y = 0;
			pause.width = 150;
			pause.text = 'P : Pause/Resume';
			addChild(pause);
		}
		
		private function putScore():void{
			myScore = new TextField();
			myScore.defaultTextFormat = myFormat;
			myScore.width = 150;
			myScore.y = 30;
			myScore.text = 'Bonus: ' + myFloats.toString();
			myScore.x = 10;
			addChild(myScore);
		}
		
		private function putLife():void{
			myLife = new TextField();
			myLife.defaultTextFormat = myFormat;
			myLife.width = 150;
			myLife.text = 'Vidas: ' + myLives.toString();
			myLife.x = 10;
			addChild(myLife);
		}
		
		private function putCoins():void{
			myMoney = new TextField();
			myMoney.defaultTextFormat = myFormat;
			myMoney.width = 150;
			myMoney.text = 'Monedas: ' + myCoins.toString();
			myMoney.x = 200;
			addChild(myMoney);
		}

		private function drawToolbar():void{
			graphics.beginFill(0xffffff);
			graphics.drawRect(0, 0, 600, 80);
			graphics.endFill();
		}
		
		private function setFormat():void{
			myFormat.color=0x000000;
			myFormat.size=16;
			myFormat.align = 'left';
			myFormat.font = 'Comic sans MS';			
		}
		
		public function get score():TextField{
			return myScore;
		}
		public function set score(value:TextField): void{
			myScore = value;
		}
		public function get points():uint{
			return myFloats;
		}
		public function set points(value:uint):void{
			myFloats = value;
		}
        
		public function get coins():TextField{
			return myMoney;
		}
		public function set coins(value:TextField):void{
			myMoney = value;
		}
		public function get coin():uint{
			return myCoins;
		}
		public function set coin(value:uint):void{
			myCoins = value;
		}
		
		public function get life():TextField{
			return myLife;
		}
		public function set life(value:TextField):void{
			myLife = value;
		}
		public function get lives():uint{
			return myLives;
		}
		public function set lives(value:uint):void{
			myLives = value;
		}
		public function get format():TextFormat{
			return myFormat;	
		}
	}
}
